import React from 'react'
import {connect} from 'react-redux'

function Counter (props) {
  return (
    <div>
      <button onClick={() => {props.dispatch({'type': 'increament', payload: 5}) }}>+1</button>
      {props.count}
      <button onClick={() => {props.dispatch({'type': 'decreament'}) }}>-1</button>
    </div>
  )
}

const mapStateToprops = state => ({
  count: state.count
})

export default connect(mapStateToprops)(Counter)